$(function () {
    //定义常用easyui对象
    var gift_datagrid = $("#gift_datagrid");
    var gift_dialog = $("#gift_dialog");
    //end

    //初始化礼品列表 gift_datagrid
    gift_datagrid.datagrid({
        title:"员工考勤表",
        url:'/check/list',
        fitColumns:true,
        fit:true,
        pagination:true,
        rownumbers:true,
        singleSelect:true,
        striped:true,
        toolbar: '#tb',
        columns:[[
            {field:'id',title:'编号',width:100},
            {field:'empId',title:'员工编号',width:100},
            {field:'empName',title:'员工姓名',width:100,align:'right'},
            {field:'beginTime',title:'上班打卡',width:100,align:'right'},
            {field:'endTime',title:'下班打卡',width:100,align:'right'},
            {field:'date',title:'日期',width:100,align:'right'},
            {field:'state',title:'状态',width:100,align:'right'},
            {field:'remark',title:'备注',width:100,align:'right'},
        ]]
    });
    //end


    //初始化保存或编辑对话框
    gift_dialog.dialog({
        width: 300,
        height: 400,
        closed: true,
        buttons:"#bb"
    });



    //响应集合函数对象
    var cmdObj = {
        //顶部工具栏的刷新
        reload: function () {
            alert("刷新啦~")
            gift_datagrid.datagrid("load");
        },

        //高级查询
        query:function () {
            //获取高级查询输入框的文本
            var kw = $("#keyword").textbox("getValue")
            if(!kw){
                $.messager.alert('温馨提示','请输入关键字');
                return;
            }
            gift_datagrid.datagrid("load",{
                keyword:kw
            })
        }
        //end

    };
    //end


    //调用
    $("a[data-cmd]").click(function(){
        var cmd = $(this).data("cmd");
        cmdObj[cmd]();
    })
    //end
})